home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5230 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.9 KB  |  97 lines

  1. Path: ix.netcom.com!netnews
  2. From: NLILLY@IXNETCOM.COM
  3. Newsgroups: comp.lang.c++
  4. Subject: Visual C++ & API Calls to SQL Database ?
  5. Date: Sat, 03 Feb 1996 03:48:57 GMT
  6. Organization: Netcom
  7. Message-ID: <4eum1q$9v7@ixnews5.ix.netcom.com>
  8. NNTP-Posting-Host: ix-min6-06.ix.netcom.com
  9. X-NETCOM-Date: Fri Feb 02  7:50:18 PM PST 1996
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. I am a Mainframe programmer who is in the process of learning Visual
  13. C++.  I have written a few simple C programs which take their
  14. information from a download file and input it into a Gupta SQLBASE 6.0
  15. database via Gupta's C API routines.  However, when I try to compile
  16. the program into a C++ program I receive the following error:
  17.  
  18. error C2664:  'sqlcnc' : cannot convert parameter 2 from 'char 
  19.     (__near *) [22] ' to 'unsigned char __far *'
  20.  
  21. The program is as follows:
  22.  
  23. #include <stdio.h>\
  24.  
  25. #include "sql.h"
  26.  
  27. SQLTAPI    sqlcmt(cur);
  28. SQLTCUR    cur;
  29. SQLTRCD    rcd;
  30. char        errmsg[SQLMERR];
  31.  
  32. main()
  33. {
  34.     if (rcd = sqlcnc(&cur, "amgdbms/sysadm/sysadm", 0))
  35.        {
  36.        ...
  37.        ...
  38.        }
  39.                  ...
  40.     ...
  41.  
  42. The abrieviated sql.h header file, with the  extern "C"  statements
  43. which I added, is as follows:
  44.  
  45. #ifndef SQL_16BITTARG
  46. #if !SQL_32BITTARG
  47. #define SQL_16BITTARG 1
  48. #else
  49. #define SQL_16BITTARG 0
  50. #endif
  51. #endif
  52. ...
  53. ...
  54. typedef     ubyte2  SQLTCUR;
  55. typedef     ubyte2  SQLTDAL;
  56. typedef     ubyte1p SQLTDAP;
  57. ...
  58. ...
  59. #if SQL_16BITTARG
  60. #define SQLTAPI byte2 far pascal
  61. #elif SQL_OS2
  62. #ifdef__IBMC__
  63. #define SQLTAPI byte2 __System
  64. #else
  65. #define SQLTAPI byte2 __syscall
  66. #endif
  67. #else
  68. #define SQLTAPI byte2 __stdcall
  69. #endif
  70. ...
  71. ...
  72. #ifndef NLINT_ARGS
  73. ...
  74. ...
  75. extern "C" {
  76. SQLTAPI sqlcnc(SQLTCUR PTR curp  ,SQLTDAP dbnamp,
  77.          SQLTDAL dbnaml);
  78. ...
  79. ...
  80.         }
  81. #else
  82. extern "C"{
  83. SQLTAPI sqlcnc();
  84. ...
  85. ...
  86.           }
  87.  
  88. I am told that Gupta does not offer any C++ API routines, and
  89. therefore I am stuck with getting the C routines to work.  I would be
  90. very grateful for any suggestions that anyone may have.
  91.  
  92. Thanks...
  93.  
  94.  
  95.  
  96.